package com.mall.goods.service.impl;

import com.mall.goods.mapper.GoodsCarouselMapper;
import com.mall.goods.model.dto.GoodsCarouselDto;
import com.mall.goods.model.vo.GoodsCarouselVo;
import com.mall.goods.service.IGoodsCarouselService;
import org.springframework.stereotype.Service;

import java.util.List;
import com.mall.common.utils.DateUtils;

import javax.annotation.Resource;

/**
 * 商品轮播配置Service业务层处理
 */
@Service
public class GoodsCarouselServiceImpl implements IGoodsCarouselService
{
    @Resource
    private GoodsCarouselMapper goodsCarouselMapper;

    /**
     * 查询商品轮播配置
     */
    @Override
    public GoodsCarouselVo selectGoodsCarouselById(Long id)
    {
        return goodsCarouselMapper.selectGoodsCarouselById(id);
    }

    /**
     * 查询商品轮播配置列表
     */
    @Override
    public List<GoodsCarouselVo> selectGoodsCarouselList(GoodsCarouselDto goodsCarouselDto)
    {
        return goodsCarouselMapper.selectGoodsCarouselList(goodsCarouselDto);
    }

    /**
     * 新增商品轮播配置
     */
    @Override
    public int insertGoodsCarousel(GoodsCarouselDto goodsCarouselDto)
    {
        goodsCarouselDto.setCreateTime(DateUtils.getNowDate());
        return goodsCarouselMapper.insertGoodsCarousel(goodsCarouselDto);
    }

    /**
     * 修改商品轮播配置
     */
    @Override
    public int updateGoodsCarousel(GoodsCarouselDto goodsCarouselDto)
    {
        goodsCarouselDto.setUpdateTime(DateUtils.getNowDate());
        return goodsCarouselMapper.updateGoodsCarousel(goodsCarouselDto);
    }

    /**
     * 批量删除商品轮播配置
     */
    @Override
    public int deleteGoodsCarouselByIds(Long[] ids)
    {
        return goodsCarouselMapper.deleteGoodsCarouselByIds(ids);
    }

    /**
     * 删除商品轮播配置信息
     */
    @Override
    public int deleteGoodsCarouselById(Long id)
    {
        return goodsCarouselMapper.deleteGoodsCarouselById(id);
    }
}
